<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2017/6/23
 * Time: 15:05
 * Project name: PHPTEST
 * File name: 2.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since 1.0.0
 */

$regex = '/^http:\/\/([\w.]+)\/([\w]+)\/([\w]+)\.html$/i';
$str = 'http://www.youku.com/show_page/id_ABCDEFG.html';
$matches = array();
if(preg_match($regex, $str, $matches)){
	var_dump($matches);
}
echo "\n";


$regex = '#^http://([\w.]+)/([\w]+)/([\w]+)\.html$#i';
$str = 'http://www.youku.com/show_page/id_ABCDEFG.html';
$matches = array();
if(preg_match($regex, $str, $matches)){
	var_dump($matches);
}
echo "\n";



$regex = '/(?<=c)d(?=e)/';  /* d 前面紧跟c, d 后面紧跟e*/
$str = 'abcdefgk';
$matches = array();

if(preg_match($regex, $str, $matches)){
	var_dump($matches);
}


$regex = '/(?<!c)d(?!e)/';  /* d 前面不紧跟c, d 后面不紧跟e*/
$str = 'abcdefgk';
$matches = array();

if(preg_match($regex, $str, $matches)){
	var_dump($matches);
}

echo "\n";

echo "\n";